<template>
  <div v-if="loadingStore.isLoading" class="global-loading">
    <div class="loading-mask"></div>
    <div class="loading-content">
      <el-icon class="is-loading">
        <Loading />
      </el-icon>
      <p class="loading-text">{{ loadingStore.loadingText }}</p>
    </div>
  </div>
</template>

<script setup lang="ts">
import { Loading } from '@element-plus/icons-vue'
import useLoadingStore from '@/store/modules/loading'

const loadingStore = useLoadingStore()
</script>

<style scoped lang="scss">
.global-loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;

  .loading-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
  }

  .loading-content {
    position: relative;
    z-index: 1;
    text-align: center;
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);

    .el-icon {
      font-size: 32px;
      color: #409eff;
      margin-bottom: 16px;
    }

    .loading-text {
      margin: 0;
      color: #606266;
      font-size: 14px;
    }
  }
}
</style> 